﻿window.onload = function() { $('abtDangKyTG').onclick = insertTraoGiai;};
function insertTraoGiai() {
    if (trim($("txtPhone").value).length == 0 || trim($("txtHoTen").value).length == 0) {
        $("pMessTG").innerHTML = langMess()[0][5];
        return;
    }
    else {
        var strUrlLocation = window.location.href;
        var strUrlLink = strPathLink_All;
        if (strUrlLocation.toLowerCase().indexOf("/yahoo/") != -1) {
            strUrlLink = strPathLink_All + "yahoo/";
        }
        utils.call(strUrlLink+"DangKyTraoGiai.aspx", { "flag": "insert", "Hoten": $("txtHoTen").value, "Phone": $("txtPhone").value }, "POST", "insertTraoGiaiResult", "insertTraoGiaiResult");
    }
}
function insertTraoGiaiResult(strResult) {
    if (strResult == "1") {
        $("txtHoTen").value = "";
        $("txtPhone").value = "";
        $("pMessTG").innerHTML = "Cám ơn bạn đã đăng ký tham gia!";
        $("pMessTG").style.color = '#93BC46';
    }    
}